import { RMIObject } from "../../Engine/RMI/RMIObject";
import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SPlayerTask } from "./SPlayerTask";
import { SeqNpcTaskHelper } from "./SeqNpcTaskHelper";
import { Exception } from "../../Framework/Util/Exception";
//class AMI_ITask_getTask
    
    export  class AMI_ITask_getTask extends RMIObject
    {
        constructor(arg1?: Function, arg2?: Function, arg3?: any)
        {
            super(arg1, arg2);
            this.userObject = arg3;
            this.callFunction = "getTask";
            return;
        }

        public /* override */ __response(arg1: SerializeStream): void
        {
            var __is: SerializeStream;
            var playerTask: SPlayerTask;
            var npcTasks: Array<any>;

            var loc1;
            playerTask = null;
            npcTasks = null;
            __is = arg1;
            try 
            {
                playerTask = new SPlayerTask();
                playerTask.__read(__is);
                npcTasks = SeqNpcTaskHelper.read(__is);
            }
            catch (__ex)
            {
                this.cdeException(new Exception("ExceptionCodeSerialize", Exception.ExceptionCodeSerialize));
                return;
            }
            this.cdeResponse(playerTask, npcTasks);
            return;
        }

        public cdeResponse(arg1: SPlayerTask, arg2: Array<any>): void
        {
            if (this._response)  
            {
                this._response.call(null, this, arg1, arg2);
            }
            return;
        }
    }
